package com.cardbaobao.cardbabyclient.utils;

import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.view.WindowManager;

/**
 * 屏幕工具类--获取手机屏幕信息
 * zad
 */
public class ScreenUtil {

	/**
	 * 获取屏幕的宽度
	 * 
	 * @param context
	 * @return
	 */
	public static int getScreenWidth(Context context) {
		DisplayMetrics  dm = new DisplayMetrics();   
		WindowManager manager = (WindowManager) context
				.getSystemService(Context.WINDOW_SERVICE);
		manager.getDefaultDisplay().getMetrics(dm);
		return dm.widthPixels;
	}

	public static int getScreenWidth(){
		return Resources.getSystem().getDisplayMetrics().widthPixels;
	}

	public static int getScreenHeight(){
		return Resources.getSystem().getDisplayMetrics().heightPixels;
	}

	/**
	 * 获取屏幕的高度
	 * 
	 * @param context
	 * @return
	 */
	public static int getScreenHeight(Context context) {
		DisplayMetrics dm = new DisplayMetrics();
		WindowManager manager = (WindowManager) context
				.getSystemService(Context.WINDOW_SERVICE);
		manager.getDefaultDisplay().getMetrics(dm);
		return dm.heightPixels;
	}
}